<template>
  <div>
    <el-form ref="form" :model="formdata" label-position="left" label-width="80px">
        <el-row :gutter="20">
            <el-col :span="5">
              <el-form-item label="用电企业">
                <FilterSelect2
                    v-model="formdata.orgNo"
                    :optionlist="qiyelist"
                    :valuekey="{ name: 'bizOrgName', value: 'bizOrgNo' }"
                  ></FilterSelect2>
              </el-form-item>
            </el-col>
            <el-col :span="5" >
              <el-form-item label="配电房" >
                <el-input v-model="formdata.powerDistributionName" style="width: 100%;" size="small" clearable placeholder=请输入配电房模糊查询></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5" >
              <el-form-item label="试验类型">
                <FilterSelect2
                    v-model="formdata.testType"
                    :optionlist="shiyanlist"
                    :valuekey="{ name: 'text', value: 'value' }"
                  ></FilterSelect2>
              </el-form-item>
            </el-col>
            <el-col :span="5" >
              <el-form-item label="状态">
                <el-select size="small" v-model="formdata.state" filterable  style="width: 100%;" placeholder="选择消状态" clearable>
                  <el-option label="未执行" value="0" />
                  <el-option label="已执行" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-show="isshow">
              <el-form-item label="设备名称" >
                <el-input v-model="formdata.deviceName" style="width: 100%;" size="small" clearable placeholder=请输入设备名称></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-show="isshow">
              <el-form-item label="试验日期">
                <el-date-picker
                  v-model="date"
                  type="daterange"
                  style="width: 100%;"
                  size="small"
                  range-separator="-"
                  value-format="yyyy-MM-dd"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="!isshow?4:18" style="text-align: right;margin-top: 4px;">
              <div>
                <span><el-button size="small" style="margin-right: 10px;" @click="chongzhi">重 置</el-button></span>
                <span class="button"
                  ><el-button size="small" type="primary" @click="chaxun">查 询</el-button></span
                >
                <span class="zhan" @click="zhankai">
                  <span class="wen">{{ isshow ? '收起' : '展开' }}</span>
                  <i v-if="isshow" class="el-icon-arrow-down"></i>
                  <i v-else class="el-icon-arrow-up"></i>
                </span>
              </div>
            </el-col>
        </el-row>
    </el-form>
  </div>
</template>

<script>
import { getDictionaryApi } from '@/api/customerFile'
import { getuserlistapi } from '@/api/analysis'
export default {
  name: 'CallPoliceSearchFor',
  props:{
    isshow:{
      type:Boolean,
      default:false
    },
    qiyelist:{
      type:Array,
      default:()=>[]
    },
    shiyanlist:{
      type:Array,
      default:()=>[]
    }
  },
  data() {
    return {
      date:['',''],
      
      formdata:{
        orgNo:'',
        state:'',
        testType:'',
        deviceName:'',
        powerDistributionName:'',
      }
    };
  },

  async mounted() {
    // const { data: { list } } = await getuserlistapi()
    // this.qiyelist=list
    // const { data: { list:array } } = await getDictionaryApi('SYGL_SYLX','')
    // this.shiyanlist=array
    this.formdata['fromDate']=this.date[0]
    this.formdata['toDate']=this.date[1]
    this.$emit('togetlist',this.formdata)
  },

  methods: {
    chaxun(){
      this.formdata['fromDate']=this.date[0]
      this.formdata['toDate']=this.date[1]
      this.$emit('togetlist',this.formdata)
    },
    chongzhi(){
      this.date=['','']
      this.formdata={
        orgNo:'',
        state:'',
        toDate:'',
        testType:'',
        fromDate:'',
        deviceName:'',
        powerDistributionName:'',
      }
      this.$emit('togetlist',this.formdata)
    },
    zhankai(){
      this.$emit('toheight')
    }
  },
};
</script>
<style lang="scss" scoped>
  .zhan{
    cursor: pointer;
    color:#1890ff;
    font-size: 14px;
  }
  .wen{
    margin:0 10px;
  }
</style>